package com.bbz.crawler.controller;

import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestParam;
import com.baomidou.mybatisplus.plugins.Page;
import com.bbz.crawler.core.commen.model.CrawlerZhihuPeopleInfo;
import com.bbz.crawler.service.ICrawlerZhihuPeopleInfoService;
/**
 * <p>
 * CrawlerZhihuPeopleInfoController
 * </p>
 *
 * @author binbin.a.zhang123
 * @since 2018-05-29
 */
@RestController
@RequestMapping("/crawlerZhihuPeopleInfo")
public class CrawlerZhihuPeopleInfoController  {

    @Autowired
    private ICrawlerZhihuPeopleInfoService crawlerZhihuPeopleInfoService;

    /**
     * 跳转到添加页面CrawlerZhihuPeopleInfo
     */
    @RequestMapping("/addCrawlerZhihuPeopleInfo")
    public String crawlerZhihuPeopleInfoAdd() {
        return  "addCrawlerZhihuPeopleInfo.html";
    }

    /**
     * 跳转到编辑页面CrawlerZhihuPeopleInfo
     */
    @RequestMapping("/editCrawlerZhihuPeopleInfo/{crawlerZhihuPeopleInfoId}")
    public String editCrawlerZhihuPeopleInfo(@PathVariable Integer crawlerZhihuPeopleInfoId, ModelMap model) {
        CrawlerZhihuPeopleInfo crawlerZhihuPeopleInfo = crawlerZhihuPeopleInfoService.selectById(crawlerZhihuPeopleInfoId);
        model.addAttribute("item",crawlerZhihuPeopleInfo);
        return "editCrawlerZhihuPeopleInfo.html";
    }

    /**
     * 获取CrawlerZhihuPeopleInfo列表
     */
    @RequestMapping(value = "/list")
    @ResponseBody
    public Object list(String condition) {
        return crawlerZhihuPeopleInfoService.selectList(null);
    }

  	/**
     * 获取CrawlerZhihuPeopleInfo列表
     */
    @RequestMapping(value = "/list/page/{page}/size/{size}")
    @ResponseBody
    public Object listPage(@PathVariable Integer page, @PathVariable Integer size) {
        return crawlerZhihuPeopleInfoService.selectMapsPage(new Page<>(page, size), null);
    }
    
    /**
     * 新增CrawlerZhihuPeopleInfo
     */
    @RequestMapping(value = "/add")
    public Object add(CrawlerZhihuPeopleInfo crawlerZhihuPeopleInfo) {
        crawlerZhihuPeopleInfoService.insert(crawlerZhihuPeopleInfo);
        return null;
    }

    /**
     * 删除CrawlerZhihuPeopleInfo
     */
    @RequestMapping(value = "/delete")
    public Object delete(@RequestParam Integer crawlerZhihuPeopleInfoId) {
        crawlerZhihuPeopleInfoService.deleteById(crawlerZhihuPeopleInfoId);
        return null;
    }

    /**
     * 修改CrawlerZhihuPeopleInfo
     */
    @RequestMapping(value = "/update")
    public Object update(CrawlerZhihuPeopleInfo crawlerZhihuPeopleInfo) {
        crawlerZhihuPeopleInfoService.updateById(crawlerZhihuPeopleInfo);
        return null;
    }

    /**
     * CrawlerZhihuPeopleInfo详情
     */
    @RequestMapping(value = "/detail/{crawlerZhihuPeopleInfoId}")
    public Object detail(@PathVariable("crawlerZhihuPeopleInfoId") Integer crawlerZhihuPeopleInfoId) {
        return crawlerZhihuPeopleInfoService.selectById(crawlerZhihuPeopleInfoId);
    }
}
